package jobManagement.impl;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;

public class JobStatus implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7600286047863064578L;
	
	private String jobStatus;
	private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);

	public JobStatus() {
		this.jobStatus = "Not submitted";
	}

	public String getJobStatus() {
		return jobStatus;
	}

	public void setJobStatus(String jobStatus) {
		String oldState = this.jobStatus;
		this.jobStatus = jobStatus;
		if (null == oldState) {
			this.pcs.firePropertyChange("jobStatus", oldState, this.jobStatus);
		} else {
			if (0 != oldState.compareToIgnoreCase(this.jobStatus)) {
				this.pcs
						.firePropertyChange("jobStatus", oldState, this.jobStatus);
			}
		}
	}

	public void addPropertyChangeListener(PropertyChangeListener listener) {
		this.pcs.addPropertyChangeListener(listener);
	}

	public void removePropertyChangeListener(PropertyChangeListener listener) {
		this.pcs.removePropertyChangeListener(listener);
	}

}
